
#pragma once

#include <map>
#include <set>
#include <string>
#include <vector>
#include <QPushButton>
#include <QSortFilterProxyModel>

#include <rviz_common/config.hpp>
#include <rviz_common/panel.hpp>
#include <rviz_common/ros_integration/ros_node_abstraction_iface.hpp>
#include <rviz_common/properties/property_tree_with_help.hpp>
#include <rviz_common/properties/property_tree_widget.hpp>
#include <rviz_common/visualization_manager.hpp>
#include <rviz_default_plugins/visibility_control.hpp>
#include "rviz_custom_plugins/utils/widget_manager.h"


using rviz_custom_plugins::utils::WidgetManager;
using rviz_common::Panel;
using rviz_common::Config;
using rviz_common::properties::PropertyTreeWithHelp;
using rviz_common::properties::PropertyTreeWidget;
using rviz_common::VisualizationManager;

namespace rviz_custom_plugins {

namespace panels {

class RVIZ_DEFAULT_PLUGINS_PUBLIC CustomDisplaysPanel : public Panel
{
  Q_OBJECT

public:
  CustomDisplaysPanel(QWidget * parent = nullptr);
  ~CustomDisplaysPanel() override = default;

  void onInitialize() override;

  void save(Config config) const override;

  void load(const Config & config) override;


// protected Q_SLOTS:
  /// Called when the "Add" button is pressed
  // void onNewDisplay();
  /// Called when the "copy" button is pressed
  // void onDuplicateDisplay();
  /// Called when the "Remove" button is pressed
  // void onDeleteDisplay();
  /// Called when the "Rename" button is pressed
  // void onRenameDisplay();

  // void onSelectionChanged();

protected:
  VisualizationManager * vis_manager_;
  PropertyTreeWidget * propertyTree;

private:
    QPointer<WidgetManager> widgetManager;

private slots:
    void handleWidgetShow(int widgetId, bool isShow);

};

}

}
